package com.study.gift.client;


import com.study.gift.domain.LoginUser;
import com.study.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class AuthClientFallbackFactory implements FallbackFactory<AuthClient> {
    @Override
    public AuthClient create(Throwable throwable) {
        return new AuthClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                log.error("熔断降级啦!"+throwable.getMessage());
                return AjaxResult.me().setSuccess(false).setMessage(throwable.getMessage());
            }
        };
    }
}
